//
//  LGReportingCenterController.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/9/8.
//  报告中心

#import "LGReportingCenterController.h"
//诊疗记录
#import "LGOutpatientRecordController.h"
//检查报告
#import "LGInspectionReportController.h"
//异常指标
#import "LGAnomalyInspectController.h"
//核心指标
#import "LGCoreInspectionController.h"
//评估报告
#import "LGEvaluationReportController.h"
//图片报告
#import "LGPhotoReportController.h"
@interface LGReportingCenterController ()
/**   */
@property (nonatomic , strong)LGNavigationView *navigationView;
/**   */
@property (nonatomic , strong)CAGradientLayer *gradientLayer;
/**  检验检查 */
@property (nonatomic , strong)LGInspectionReportController *inspectionVC;
/**  出入院记录 */
@property (nonatomic , strong)LGInspectionReportController *hospitalVC;
/**  门诊病历 */
@property (nonatomic , strong)LGOutpatientRecordController *outpatientVC;
/**  图片报告 */
@property (nonatomic , strong)LGPhotoReportController *photoVC;
/**  评估报告 */
@property (nonatomic , strong)LGEvaluationReportController *evaluationVC;
/**  异常指标 */
@property (nonatomic , strong)LGAnomalyInspectController *anomalyVC;
/**  核心指标 */
@property (nonatomic , strong)LGCoreInspectionController *coreInspectVC;
/**   */
@property (nonatomic , strong)NSMutableArray *controllerArray;
/**   */
@property (nonatomic , strong)NSArray *titleArray;
/**   */
@property (nonatomic , strong)NSArray *widthArray;
@end

@implementation LGReportingCenterController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"报告中心";
    [self commonInit];
    self.selectIndex = self.currentIndex;
    [self reloadData];
    self.scrollView.backgroundColor = [UIColor clearColor];
}

-(void)backButtonAction{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark
#pragma mark ====> WMPageControllerDelegate
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titleArray.count;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titleArray[index];
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    return self.controllerArray[index];
}

- (CGFloat)menuView:(WMMenuView *)menu widthForItemAtIndex:(NSInteger)index {
    return (Screen_W-10)/5.0;
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView {
    return CGRectMake(0, topBarHeight, Screen_W, viewPix(44));
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
    return CGRectMake(0, topBarHeight+viewPix(44), Screen_W, Screen_H-topBarHeight-viewPix(44));
}

- (void)pageController:(WMPageController *)pageController willEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info{
    LGBaseViewController *controller = (LGBaseViewController *)viewController;
    [controller viewWillAppearAction];
    NSLog(@">>>>>willEnterView>>>%@",viewController.title);
}

- (void)pageController:(WMPageController *)pageController didEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info{
    NSLog(@">>>>>didEnterView>>>%@",viewController.title);
}

-(void)commonInit{
    self.fd_prefersNavigationBarHidden = YES;
    self.view.backgroundColor = kNavBgColor;
    [self.view addSubview:self.navigationView];
    self.titleArray = @[@"检验检查",@"出入院记录",@"门诊病历",@"图片报告",@"健康评估",@"异常指标",@"核心指标"];
    [self addChildViewController:self.inspectionVC];
    [self addChildViewController:self.hospitalVC];
    [self addChildViewController:self.outpatientVC];
    [self addChildViewController:self.photoVC];
    [self addChildViewController:self.evaluationVC];
    [self addChildViewController:self.anomalyVC];
    [self addChildViewController:self.coreInspectVC];
   
    [self.controllerArray addObject:self.inspectionVC];
    [self.controllerArray addObject:self.hospitalVC];
    [self.controllerArray addObject:self.outpatientVC];
    [self.controllerArray addObject:self.photoVC];
    [self.controllerArray addObject:self.evaluationVC];
    [self.controllerArray addObject:self.anomalyVC];
    [self.controllerArray addObject:self.coreInspectVC];
    
    self.titleColorNormal = [UIColor colorWithString:@"#666666"];
    self.titleColorSelected = [UIColor colorWithString:@"#4C87FD"];
    self.progressColor = [UIColor colorWithString:@"#3291FF"];
    self.menuViewStyle=WMMenuViewStyleLine;
    self.titleFontName = @"STHeitiTC-Medium";
    self.titleSizeSelected = 16;
    self.titleSizeNormal = 14;
    self.progressWidth = viewPix(13);
    self.progressHeight = 4;
    self.progressViewBottomSpace = 0;
    self.progressViewCornerRadius = 2;
    [self reloadData];
    self.scrollView.backgroundColor = [UIColor clearColor];
}

-(NSMutableArray *)controllerArray{
    if(!_controllerArray){
        _controllerArray = [NSMutableArray array];
    }
    return _controllerArray;
}

-(CAGradientLayer *)gradientLayer{
    if(!_gradientLayer){
        _gradientLayer = [CAGradientLayer layer];
        _gradientLayer.frame = CGRectMake(0,topBarHeight,Screen_W,viewPix(167));
        _gradientLayer.startPoint = CGPointMake(0.5, 0);
        _gradientLayer.endPoint = CGPointMake(0.5, 1.03);
        _gradientLayer.colors = @[(__bridge id)[UIColor colorWithString:@"#E5F3FF"].CGColor, (__bridge id)[UIColor colorWithString:@"#F3F9FE"].CGColor, (__bridge id)[UIColor colorWithString:@"#FEFEFF" alpha:0].CGColor];
        _gradientLayer.locations = @[@(0), @(0.4f), @(1.0f)];
    }
    return _gradientLayer;
}

-(LGNavigationView *)navigationView{
    if(!_navigationView){
        _navigationView = [[LGNavigationView alloc]initWithFrame:CGRectMake(0, 0, Screen_W, topBarHeight)];
        _navigationView.backgroundColor = [UIColor colorWithString:@"#E5F3FF"];
        _navigationView.title = @"报告中心";
        [_navigationView.backBtn addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _navigationView;
}

-(LGInspectionReportController *)inspectionVC{
    if(!_inspectionVC){
        _inspectionVC = [[LGInspectionReportController alloc]init];
        _inspectionVC.patientid = self.patientid;
        _inspectionVC.data_type = @"2";
    }
    return _inspectionVC;
}

-(LGInspectionReportController *)hospitalVC{
    if(!_hospitalVC){
        _hospitalVC = [[LGInspectionReportController alloc]init];
        _hospitalVC.patientid = self.patientid;
        _hospitalVC.data_type = @"1";
    }
    return _hospitalVC;
}

-(LGOutpatientRecordController *)outpatientVC{
    if(!_outpatientVC){
        _outpatientVC = [[LGOutpatientRecordController alloc]init];
        _outpatientVC.patientid = self.patientid;
    }
    return _outpatientVC;
}

-(LGPhotoReportController *)photoVC{
    if(!_photoVC){
        _photoVC = [[LGPhotoReportController alloc]init];
        _photoVC.patientid = self.patientid;
    }
    return _photoVC;
}

-(LGEvaluationReportController *)evaluationVC{
    if(!_evaluationVC){
        _evaluationVC = [[LGEvaluationReportController alloc]init];
        _evaluationVC.patientid = self.patientid;
    }
    return _evaluationVC;
}

-(LGAnomalyInspectController *)anomalyVC{
    if(!_anomalyVC){
        _anomalyVC = [[LGAnomalyInspectController alloc]init];
        _anomalyVC.patientid = self.patientid;
    }
    return _anomalyVC;
}

-(LGCoreInspectionController *)coreInspectVC{
    if(!_coreInspectVC){
        _coreInspectVC = [[LGCoreInspectionController alloc]init];
        _coreInspectVC.patientid = self.patientid;
    }
    return _coreInspectVC;
}





/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
